﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Light.Utility.HtmlTable
{
    public class Column
    {
        
        private Alignment _align = Alignment.Left;
        private Color _backColor = Color.Empty;
        private int _columnIndex = 0;
        private FontSetter _fontSetter = null;
        private bool _isLinkColumn = false;
        private Table _table;

        
        public Column(int columnIndex, Table table)
        {
            this._columnIndex = columnIndex;
            this._table = table;
            this._align = this._table.Align;
            this._backColor = this._table.BackColor;
            this._fontSetter = this._table.FontSetter;
            this._isLinkColumn = false;
        }

        
        public Alignment Align
        {
            get
            {
                return this._align;
            }
            set
            {
                this._align = value;
                for (int i = 0; i < this._table.Rows.Count; i++)
                {
                    this._table.Rows[i].Cells[this.ColumnIndex].Align = this._align;
                }
            }
        }

        public Color BackColor
        {
            get
            {
                return this._backColor;
            }
            set
            {
                this._backColor = value;
                for (int i = 0; i < this._table.Rows.Count; i++)
                {
                    this._table.Rows[i].Cells[this.ColumnIndex].BackColor = this._backColor;
                }
            }
        }

        public int ColumnIndex
        {
            get
            {
                return this._columnIndex;
            }
            set
            {
                this._columnIndex = value;
            }
        }

        public FontSetter FontSetter
        {
            get
            {
                return this._fontSetter;
            }
            set
            {
                this._fontSetter = value;
                for (int i = 0; i < this._table.Rows.Count; i++)
                {
                    this._table.Rows[i].Cells[this.ColumnIndex].FontSetter = this._fontSetter;
                }
            }
        }

        public bool IsLinkColumn
        {
            get
            {
                return this._isLinkColumn;
            }
            set
            {
                this._isLinkColumn = value;
                for (int i = 0; i < this._table.Rows.Count; i++)
                {
                    this._table.Rows[i].Cells[this.ColumnIndex].IsLink = value;
                }
            }
        }
    }




}
